#include "compoundpresenter.h"

CompoundPresenter::CompoundPresenter()
{}

CompoundPresenter::~CompoundPresenter() {
    for (PrList::iterator it = Presenters.begin(), ie = Presenters.end(); it != ie; ++it) {
        delete *it;
    }
}

CompoundPresenter& CompoundPresenter::addPresenter(AbstractPresenter *pr) {
    Presenters.push_back(pr);
    return *this;
}

void CompoundPresenter::display(const Answer &an) {
    for (PrList::iterator it = Presenters.begin(), ie = Presenters.end(); it != ie; ++it) {
        (*it)->display(an);
    }
}


CompoundPresenter& operator << (CompoundPresenter& cp, AbstractPresenter* pr) {
    return cp.addPresenter(pr);
}
